package com.yang.service.adminimpl;

import com.yang.bean.*;
import com.yang.bean.fxy.vo.DashboardVo;
import com.yang.mapper.MarketGoodsMapper;
import com.yang.mapper.MarketGoodsProductMapper;
import com.yang.mapper.MarketOrderMapper;
import com.yang.mapper.MarketUserMapper;
import com.yang.service.admin.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName AdminServiceImpl
 * @Description:
 * @Author TrueEnd
 * @Date 2022/9/6
 * @Version
 **/
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    MarketUserMapper marketUserMapper;
    @Autowired
    MarketGoodsMapper marketGoodsMapper;
    @Autowired
    MarketGoodsProductMapper marketGoodsProductMapper;
    @Autowired
    MarketOrderMapper marketOrderMapper;



    @Override
    public DashboardVo dashboard() {

        long goodsTotal = marketGoodsMapper.countByExample(new MarketGoodsExample());
        long userTotal = marketUserMapper.countByExample(new MarketUserExample());
        long productTotal = marketGoodsProductMapper.countByExample(new MarketGoodsProductExample());
        long orderTotal = marketOrderMapper.countByExample(new MarketOrderExample());


        return new DashboardVo(goodsTotal,userTotal,productTotal,orderTotal);
    }
}
